import { isHidden } from "vant/lib/utils";
import { createRouter, createWebHashHistory } from "vue-router";
const defRoutes = [
  {
    path: "/",
    redirect: "/login",
  },
  {
    name: "login",
    path: "/login",
    component: () => import("@/views/login/login.vue"),
  },
];
export const routes = [
  {
    path: "/home",
    name: "Home",
    redirect: "/leaderHome",
    meta: { title: "系统首页", icon: "icon-xianxingtubiaozhizuomoban-47" },
    children: [
      {
        path: "/leaderHome",
        component: () => import("@/views/home/leaderHome.vue"),
        name: "leaderHome",
        meta: { title: "首页中心", icon: "icon-tongjifenxi" },
      },
      {
        path: "/comCenter",
        isHidden: true,
        component: () => import("@/views/home/comCenter.vue"),
        name: "ComCenter",
        meta: { title: "账户中心", icon: "icon-tongjifenxi" },
      },
      {
        path: "/homeTalkCenter",
        component: () => import("@/views/home/homeTalkCenter.vue"),
        name: "homeTalkCenter",
        meta: { title: "招派广场", icon: "icon-tongjifenxi" },
      },
      {
        path: "/artDetail",
        isHidden: true,
        component: () => import("@/views/home/artDetail.vue"),
        name: "artDetail",
        meta: { title: "公告详情" },
      },
    ],
  },
  {
    path: "/staff",
    name: "Staff",
    redirect: "/staffList",
    meta: { title: "员工管理", icon: "icon-yuangongguanli" },
    children: [
      {
        path: "/staffKPI",
        component: () => import("@/views/staff/staffKPI.vue"),
        name: "StaffKPI",
        meta: { title: "KPI统计", icon: "icon-KPI" },
      },
      {
        path: "/staffList",
        component: () => import("@/views/staff/staffList.vue"),
        name: "StaffList",
        meta: { title: "员工列表", icon: "icon-yuangongliebiao" },
      },
      {
        path: "/staffListAdd",
        isHidden: true,
        component: () => import("@/views/staff/staffList/staffListAdd.vue"),
        name: "StaffListAdd",
        meta: { title: "新增员工" },
      },
      {
        path: "/staffListDetail",
        isHidden: true,
        component: () => import("@/views/staff/staffList/staffListDetail.vue"),
        name: "StaffListDetail",
        meta: { title: "员工详情" },
      },
    ],
  },
  {
    path: "/flotilla",
    name: "Flotilla",
    redirect: "/flotillaList",
    meta: { title: "船队管理", icon: "icon-yuangongguanli" },
    children: [
      {
        path: "/flotillaList",
        component: () => import("@/views/flotilla/flotillaList.vue"),
        name: "FlotillaList",
        meta: { title: "船队列表", icon: "icon-yuangongliebiao" },
      },

      {
        path: "/flotillaListAdd",
        isHidden: true,
        component: () =>
          import("@/views/flotilla/flotillaList/flotillaListAdd.vue"),
        name: "FlotillaListAdd",
        meta: { title: "新增船队" },
      },
      {
        path: "/flotillaListDetail",
        isHidden: true,
        component: () =>
          import("@/views/flotilla/flotillaList/flotillaListDetail.vue"),
        name: "flotillaListDetail",
        meta: { title: "船队详情" },
      },
      {
        path: "/flotillaBoot",
        component: () => import("@/views/flotilla/flotillaBoot.vue"),
        name: "flotillaBoot",
        meta: { title: "船舶列表", icon: "icon-yuangongliebiao" },
      },
      {
        path: "/flotillaBootAdd",
        isHidden: true,
        component: () =>
          import("@/views/flotilla/flotillaBoot/flotillaBootAdd.vue"),
        name: "flotillaBootAdd",
        meta: { title: "新增船舶", icon: "icon-yuangongliebiao" },
      },
      {
        path: "/flotillaBootDetail",
        isHidden: true,
        component: () =>
          import("@/views/flotilla/flotillaBoot/flotillaBootDetail.vue"),
        name: "flotillaBootDetail",
        meta: { title: "船舶详情", icon: "icon-yuangongliebiao" },
      },
    ],
  },

  {
    path: "/cooperation",
    name: "Cooperation",
    redirect: "/cooperationBooter",
    meta: { title: "合作企业", icon: "icon-keyipingtaihezuofangan" },
    children: [
      {
        path: "/cooperationBooter",
        component: () => import("@/views/cooperation/cooperationBooter.vue"),
        name: "CooperationBooter",
        meta: { title: "合作管理", icon: "icon-edit" },
      },
      {
        path: "/cooperationBooterAdd",
        isHidden: true,
        component: () =>
          import(
            "@/views/cooperation/cooperationBooter/cooperationBooterAdd.vue"
          ),
        name: "CooperationBooterAdd",
        meta: { title: "合作新增" },
      },
      {
        path: "/cooperationBooterDetail",
        isHidden: true,
        component: () =>
          import(
            "@/views/cooperation/cooperationBooter/cooperationBooterDetail.vue"
          ),
        name: "CooperationBooterDetail",
        meta: { title: "合作详情" },
      },
    ],
  },
  {
    path: "/work",
    name: "work",
    redirect: "/workList",
    meta: { title: "岗位管理", icon: "icon-gangwei" },
    children: [
      {
        path: "/workList",
        component: () => import("@/views/work/workList.vue"),
        name: "WorkList",
        meta: { title: "岗位列表", icon: "icon-gangwei" },
      },
      {
        path: "/workListAdd",
        isHidden: true,
        component: () => import("@/views/work/workList/workListAdd.vue"),
        name: "WorkListAdd",
        meta: { title: "岗位新增" },
      },
      {
        path: "/workListDetail",
        isHidden: true,
        component: () => import("@/views/work/workList/workListDetail.vue"),
        name: "WorkListDetail",
        meta: { title: "岗位详情" },
      },
      {
        path: "/workSign",
        component: () => import("@/views/work/workSign.vue"),
        name: "WorkSign",
        meta: { title: "投递记录", icon: "icon-baoming" },
      },
    ],
  },

  {
    path: "/sala",
    name: "Sala",
    redirect: "/workList",
    meta: { title: "船员大厅", icon: "icon-wodejianli" },
    children: [
      {
        path: "/salaPublic",
        component: () => import("@/views/sala/salaPublic.vue"),
        name: "SalaPublic",
        meta: { title: "公海池", icon: "icon-hulianwang" },
      },
      {
        path: "/salaPublicDetail",
        isHidden: true,
        component: () => import("@/views/sala/salaPublic/salaPublicDetail.vue"),
        name: "SalaPublicDetail",
        meta: { title: "船员简历详情" },
      },
      {
        path: "/salaExport",
        isHidden: true,
        component: () => import("@/views/sala/salaExport.vue"),
        name: "salaExport",
        meta: { title: "船员简历详情" },
      },
      {
        path: "/salaSelf",
        component: () => import("@/views/sala/salaSelf.vue"),
        name: "SalaSelf",
        meta: { title: "人才库", icon: "icon-private-net" },
      },
      {
        path: "/salaSelfEnter",
        isHidden: true,
        component: () => import("@/views/sala/salaSelf/salaSelfEnter.vue"),
        name: "SalaSelfEnter",
        meta: { title: "录入简历" },
      },
      {
        path: "/salaSave",
        component: () => import("@/views/sala/salaSave.vue"),
        name: "SalaSave",
        meta: { title: "船员收藏", icon: "icon-shoucang1" },
      },
      {
        path: "/salaTalk",
        component: () => import("@/views/sala/salaTalk.vue"),
        name: "SalaTalk",
        meta: { title: "沟通记录", icon: "icon-goutongjilu1" },
      },
    ],
  },
  {
    path: "/boot",
    name: "Boot",
    redirect: "/bootSign",
    meta: { title: "船员管理", icon: "icon-chuanyuanzhaopin" },
    children: [
      {
        path: "/bootSign",
        component: () => import("@/views/boot/bootSign.vue"),
        name: "BootSign",
        meta: { title: "在职船员", icon: "icon-a-zu1" },
      },
      {
        path: "/bootSignJoin",
        isHidden: true,
        component: () => import("@/views/boot/bootSign/bootSignJoin.vue"),
        name: "BootSignJoin",
        meta: { title: "签约操作" },
      },
      {
        path: "/bootSignDetail",
        isHidden: true,
        component: () => import("@/views/boot/bootSign/bootSignDetail.vue"),
        name: "BootSignDetail",
        meta: { title: "签约详情" },
      },
      {
        path: "/bootInviteDetail",
        isHidden: true,
        component: () => import("@/views/boot/bootInviteDetail.vue"),
        name: "BootInviteDetail",
        meta: { title: "签约船员" },
      },
      {
        path: "/bootLeave",
        component: () => import("@/views/boot/bootLeave.vue"),
        name: "BootLeave",
        meta: { title: "离职船员", icon: "icon-lizhi2" },
      },
      {
        path: "/bootInvite",
        component: () => import("@/views/boot/bootInvite.vue"),
        name: "BootInvite",
        meta: { title: "面试记录", icon: "icon-mianshi1" },
      },
      {
        path: "/bootMoney",
        component: () => import("@/views/boot/bootMoney.vue"),
        name: "BootMoney",
        meta: { title: "船员薪酬", icon: "icon-xiaoshoujingxiaoshangzhunru" },
      },
      {
        path: "/bootMoneyDetail",
        isHidden: true,
        component: () => import("@/views/boot/bootMoneyDetail.vue"),
        name: "BootMoneyDetail",
        meta: { title: "薪酬详情" },
      },
    ],
  },
  {
    path: "/recordList",
    name: "recordList",
    redirect: "/recordList",
    meta: { title: "系统日志", icon: "icon-xianxingtubiaozhizuomoban-47" },
    children: [
      {
        path: "/recordList",
        component: () => import("@/views/record/recordList.vue"),
        name: "recordList",
        meta: { title: "操作记录", icon: "icon-gangwei" },
      },
    ],
  },
];

const router = createRouter({
  history: createWebHashHistory(),
  routes: defRoutes.concat(routes),
});
router.beforeEach((to, from, next) => {
  if (from.query.page) {
    localStorage.setItem("boot_page", from.query.page);
  } else {
    localStorage.setItem("boot_page", 1);
  }
  next();
});
export default router;
